import React from 'react'
import {
    useParams,//获取地址栏id
    useLocation, //获取动态路由传参,
    useNavigate,//跳路由
} from "react-router-dom"
import {ProductCard } from 'react-vant';
import HocWithRouter from "../utlis/HocwithRouter"
function Detail({router}) {
    // console.log(props);
    // const params = useParams()
    // const location = useLocation()
    // const navigate = useNavigate()
    // console.log(location);
    
    return (
        <div>
           Detail 
           <button onClick={()=>router.navigate(-1)}>返回上一级</button>
           <br/>
           id:{router.params.id}
           <ProductCard
                num={router.location.state.count}
                price={router.location.state.price}
                desc="描述信息"
                title={router.location.state.title}
                thumb={router.location.state.img}
                />
        </div>
    )
}

export default HocWithRouter(Detail)
